#ifndef __COUNT_DOWN_LATCH_INCLUDE__
#define __COUNT_DOWN_LATCH_INCLUDE__

#include <boost/thread/mutex.hpp>
#include <boost/thread/condition_variable.hpp>

class CountDownLatch : boost::noncopyable
{
public:
    CountDownLatch(unsigned int var = 0);

    void wait();

    void countDown();
    void countUp();

    int getCount() const;
    void setCount(int count);

private:
    mutable boost::mutex mutex_;
    boost::condition_variable_any  condition_;
    int count_;
};

#endif